/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.base.entity.customer;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.base.entity.customerdataconfig.CustomerDataconfig;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

/**
 * 客户Entity
 * @author lv
 * @version 2021-02-25
 */
@Table(name="t_customer_data", alias="a", columns={
		@Column(name="data_id", attrName="dataId", label="资料ID", isPK=true),
		@Column(name="data_name", attrName="dataName", label="名称", queryType=QueryType.LIKE),
		@Column(name="required", attrName="required", label="是否必填"),
		@Column(name="customer_id", attrName="customerId.customerId", label="客户ID"),
	},joinTable = {
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = CustomerDataconfig.class, attrName = "customerDataconfig", alias = "b",
                on = "b.datacon_id = a.data_name",
                columns = {
                        @Column(name = "datacon_id", label = "资料信息配置id", isPK = true),
                        @Column(name = "datacon_name", label = "资料信息名称"),
                }),
}, orderBy="a.data_id ASC"
)
public class CustomerData extends DataEntity<CustomerData> {
	
	private static final long serialVersionUID = 1L;
	private String dataId;		// 资料ID
	private String dataName;		// 名称
	private String required;		// 是否必填
	private String requiredText;		// 是否必填
	private Customer customerId;		// 客户ID 父类
    private CustomerDataconfig customerDataconfig;
	
	public CustomerData() {
		this(null);
	}


	public CustomerData(Customer customerId){
		this.customerId = customerId;
	}
	
	public String getDataId() {
		return dataId;
	}

	public void setDataId(String dataId) {
		this.dataId = dataId;
	}
	
	@NotBlank(message="名称不能为空")
	@Length(min=0, max=100, message="名称长度不能超过 100 个字符")
	public String getDataName() {
		return dataName;
	}

	public void setDataName(String dataName) {
		this.dataName = dataName;
	}
	
	@NotBlank(message="是否必填不能为空")
	@Length(min=0, max=1, message="是否必填长度不能超过 1 个字符")
	public String getRequired() {
		return required;
	}

	public void setRequired(String required) {
		this.required = required;
	}
	
	@Length(min=0, max=64, message="客户ID长度不能超过 64 个字符")
	public Customer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Customer customerId) {
		this.customerId = customerId;
	}

    public String getRequiredText() {
        return requiredText;
    }

    public void setRequiredText(String requiredText) {
        this.requiredText = requiredText;
    }

    public CustomerDataconfig getCustomerDataconfig() {
        return customerDataconfig;
    }

    public void setCustomerDataconfig(CustomerDataconfig customerDataconfig) {
        this.customerDataconfig = customerDataconfig;
    }
}